﻿namespace Hopfield.Simulator
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Globalization;
    using System.Text;
    using System.Windows.Forms;    

    public partial class ExceptionForm : Form
    {
        public ExceptionForm(Exception ex)
        {
            this.InitializeComponent();

            string text = string.Empty;
            Exception iex = ex;
            while (iex != null)
            {
                text += string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}",
                                      iex.GetType().ToString(),
                                      Environment.NewLine,
                                      iex.Message,
                                      Environment.NewLine,
                                      iex.StackTrace,
                                      Environment.NewLine);
                iex = iex.InnerException;
            }

            this.textBoxException.Text = text;
        }
    }
}
